*** Do File for Paper ***

clear
use "C:\Users\David Macdonald\Dropbox\Final APR White Identity and Immigration\Final Clean VSG Panel Study Survey Data.dta"

* (Consistent_White = White race in 2016, 2017, and 2018)

*** Ordered Probit Regression Results - Table 2 ***

*Europe*
oprobit Immig_Europe_2018 White_Identity_2017_01 Partisanship_2017_01 Ideology_2017_01 Index_Trump_Attitudes_2017_01 ///
Index_Authoritarianism_2016_01 Index_Egalitarianism_2017_01 Index_Nationalism_2016_01 Index_Populism_2017_01 Index_Social_Trust_2016_01 ///
Satisfy_Local_Econ_2017_01 Satisfy_Personal_Income_2017_01 Age_2018 Female_2018 College_2018 Married_2018 i.State_2018 if Consistent_White==1, cluster(State_2018)
outreg2 using tab.tex, addstat(Pseudo R$^2$, `e(r2_p)') dec(3) replace

*Africa*
oprobit Immig_Africa_2018 White_Identity_2017_01 Partisanship_2017_01 Ideology_2017_01 Index_Trump_Attitudes_2017_01 ///
Index_Authoritarianism_2016_01 Index_Egalitarianism_2017_01 Index_Nationalism_2016_01 Index_Populism_2017_01 Index_Social_Trust_2016_01 ///
Satisfy_Local_Econ_2017_01 Satisfy_Personal_Income_2017_01 Age_2018 Female_2018 College_2018 Married_2018 i.State_2018 if Consistent_White==1, cluster(State_2018)
outreg2 using tab.tex, addstat(Pseudo R$^2$, `e(r2_p)') dec(3) append

*China*
oprobit Immig_China_2018 White_Identity_2017_01 Partisanship_2017_01 Ideology_2017_01 Index_Trump_Attitudes_2017_01 ///
Index_Authoritarianism_2016_01 Index_Egalitarianism_2017_01 Index_Nationalism_2016_01 Index_Populism_2017_01 Index_Social_Trust_2016_01 ///
Satisfy_Local_Econ_2017_01 Satisfy_Personal_Income_2017_01 Age_2018 Female_2018 College_2018 Married_2018 i.State_2018 if Consistent_White==1, cluster(State_2018)
outreg2 using tab.tex, addstat(Pseudo R$^2$, `e(r2_p)') dec(3) append

*India*
oprobit Immig_India_2018 White_Identity_2017_01 Partisanship_2017_01 Ideology_2017_01 Index_Trump_Attitudes_2017_01 ///
Index_Authoritarianism_2016_01 Index_Egalitarianism_2017_01 Index_Nationalism_2016_01 Index_Populism_2017_01 Index_Social_Trust_2016_01 ///
Satisfy_Local_Econ_2017_01 Satisfy_Personal_Income_2017_01 Age_2018 Female_2018 College_2018 Married_2018 i.State_2018 if Consistent_White==1, cluster(State_2018)
outreg2 using tab.tex, addstat(Pseudo R$^2$, `e(r2_p)') dec(3) append

*Mexico & Latin America*
oprobit Immig_Mexico_2018 White_Identity_2017_01 Partisanship_2017_01 Ideology_2017_01 Index_Trump_Attitudes_2017_01 ///
Index_Authoritarianism_2016_01 Index_Egalitarianism_2017_01 Index_Nationalism_2016_01 Index_Populism_2017_01 Index_Social_Trust_2016_01 ///
Satisfy_Local_Econ_2017_01 Satisfy_Personal_Income_2017_01 Age_2018 Female_2018 College_2018 Married_2018 i.State_2018 if Consistent_White==1, cluster(State_2018)
outreg2 using tab.tex, addstat(Pseudo R$^2$, `e(r2_p)') dec(3) append

*Middle East*
oprobit Immig_Mideast_2018 White_Identity_2017_01 Partisanship_2017_01 Ideology_2017_01 Index_Trump_Attitudes_2017_01 ///
Index_Authoritarianism_2016_01 Index_Egalitarianism_2017_01 Index_Nationalism_2016_01 Index_Populism_2017_01 Index_Social_Trust_2016_01 ///
Satisfy_Local_Econ_2017_01 Satisfy_Personal_Income_2017_01 Age_2018 Female_2018 College_2018 Married_2018 i.State_2018 if Consistent_White==1, cluster(State_2018) 
outreg2 using tab.tex, addstat(Pseudo R$^2$, `e(r2_p)') dec(3) append

*******************************************************************************************************************************************************************************

*** Marginal Effects - Figure 1 ***
oprobit Immig_Europe_2018 White_Identity_2017_01 Partisanship_2017_01 Ideology_2017_01 Index_Trump_Attitudes_2017_01 ///
Index_Authoritarianism_2016_01 Index_Egalitarianism_2017_01 Index_Nationalism_2016_01 Index_Populism_2017_01 Index_Social_Trust_2016_01 ///
Satisfy_Local_Econ_2017_01 Satisfy_Personal_Income_2017_01 Age_2018 Female_2018 College_2018 Married_2018 i.State_2018 if Consistent_White==1, cluster(State_2018)
margins, dydx(White_Identity_2017_01) predict(outcome(1)) saving(m1, replace) 

oprobit Immig_Africa_2018 White_Identity_2017_01 Partisanship_2017_01 Ideology_2017_01 Index_Trump_Attitudes_2017_01 ///
Index_Authoritarianism_2016_01 Index_Egalitarianism_2017_01 Index_Nationalism_2016_01 Index_Populism_2017_01 Index_Social_Trust_2016_01 ///
Satisfy_Local_Econ_2017_01 Satisfy_Personal_Income_2017_01 Age_2018 Female_2018 College_2018 Married_2018 i.State_2018 if Consistent_White==1, cluster(State_2018)
margins, dydx(White_Identity_2017_01) predict(outcome(1)) saving(m2, replace)

oprobit Immig_China_2018 White_Identity_2017_01 Partisanship_2017_01 Ideology_2017_01 Index_Trump_Attitudes_2017_01 ///
Index_Authoritarianism_2016_01 Index_Egalitarianism_2017_01 Index_Nationalism_2016_01 Index_Populism_2017_01 Index_Social_Trust_2016_01 ///
Satisfy_Local_Econ_2017_01 Satisfy_Personal_Income_2017_01 Age_2018 Female_2018 College_2018 Married_2018 i.State_2018 if Consistent_White==1, cluster(State_2018)
margins, dydx(White_Identity_2017_01) predict(outcome(1)) saving(m3, replace)

oprobit Immig_India_2018 White_Identity_2017_01 Partisanship_2017_01 Ideology_2017_01 Index_Trump_Attitudes_2017_01 ///
Index_Authoritarianism_2016_01 Index_Egalitarianism_2017_01 Index_Nationalism_2016_01 Index_Populism_2017_01 Index_Social_Trust_2016_01 ///
Satisfy_Local_Econ_2017_01 Satisfy_Personal_Income_2017_01 Age_2018 Female_2018 College_2018 Married_2018 i.State_2018 if Consistent_White==1, cluster(State_2018)
margins, dydx(White_Identity_2017_01) predict(outcome(1)) saving(m4, replace)

oprobit Immig_Mexico_2018 White_Identity_2017_01 Partisanship_2017_01 Ideology_2017_01 Index_Trump_Attitudes_2017_01 ///
Index_Authoritarianism_2016_01 Index_Egalitarianism_2017_01 Index_Nationalism_2016_01 Index_Populism_2017_01 Index_Social_Trust_2016_01 ///
Satisfy_Local_Econ_2017_01 Satisfy_Personal_Income_2017_01 Age_2018 Female_2018 College_2018 Married_2018 i.State_2018 if Consistent_White==1, cluster(State_2018)
margins, dydx(White_Identity_2017_01) predict(outcome(1)) saving(m5, replace)

oprobit Immig_Mideast_2018 White_Identity_2017_01 Partisanship_2017_01 Ideology_2017_01 Index_Trump_Attitudes_2017_01 ///
Index_Authoritarianism_2016_01 Index_Egalitarianism_2017_01 Index_Nationalism_2016_01 Index_Populism_2017_01 Index_Social_Trust_2016_01 ///
Satisfy_Local_Econ_2017_01 Satisfy_Personal_Income_2017_01 Age_2018 Female_2018 College_2018 Married_2018 i.State_2018 if Consistent_White==1, cluster(State_2018) 
margins, dydx(White_Identity_2017_01) predict(outcome(1)) saving(m6, replace)

combomarginsplot m1 m2 m3 m4 m5 m6, horizontal

*******************************************************************************************************************************************************************************

*** Marginal Effects - Figure 2 *** 
clear
*use "C:\Users\dmac9\Dropbox\RESEARCH IDEAS\Idea White Identity and White Immigrants\Clean VSG Panel Study Survey Data.dta"
use "C:\Users\davidmacdonald\Dropbox\RESEARCH IDEAS\Idea White Identity and White Immigrants\Clean VSG Panel Study Survey Data.dta"

*Europe*
oprobit Immig_Europe_2018 White_Identity_2017_01 Partisanship_2017_01 Ideology_2017_01 Index_Trump_Attitudes_2017_01 ///
Index_Authoritarianism_2016_01 Index_Egalitarianism_2017_01 Index_Nationalism_2016_01 Index_Populism_2017_01 Index_Social_Trust_2016_01 ///
Satisfy_Local_Econ_2017_01 Satisfy_Personal_Income_2017_01 Age_2018 Female_2018 College_2018 i.State_2018 if Consistent_White==1, cluster(State_2018)
margins, at(White_Identity_2017_01=(0(.25)1)) 
marginsplot 

*Africa*
oprobit Immig_Africa_2018 White_Identity_2017_01 Partisanship_2017_01 Ideology_2017_01 Index_Trump_Attitudes_2017_01 ///
Index_Authoritarianism_2016_01 Index_Egalitarianism_2017_01 Index_Nationalism_2016_01 Index_Populism_2017_01 Index_Social_Trust_2016_01 ///
Satisfy_Local_Econ_2017_01 Satisfy_Personal_Income_2017_01 Age_2018 Female_2018 College_2018 i.State_2018 if Consistent_White==1, cluster(State_2018)
outreg2 using tab.tex, addstat(Pseudo R$^2$, `e(r2_p)') dec(3) append
margins, at(White_Identity_2017_01=(0(.25)1)) 
marginsplot

*China*
oprobit Immig_China_2018 White_Identity_2017_01 Partisanship_2017_01 Ideology_2017_01 Index_Trump_Attitudes_2017_01 ///
Index_Authoritarianism_2016_01 Index_Egalitarianism_2017_01 Index_Nationalism_2016_01 Index_Populism_2017_01 Index_Social_Trust_2016_01 ///
Satisfy_Local_Econ_2017_01 Satisfy_Personal_Income_2017_01 Age_2018 Female_2018 College_2018 i.State_2018 if Consistent_White==1, cluster(State_2018)
outreg2 using tab.tex, addstat(Pseudo R$^2$, `e(r2_p)') dec(3) append
margins, at(White_Identity_2017_01=(0(.25)1)) 
marginsplot

*India*
oprobit Immig_India_2018 White_Identity_2017_01 Partisanship_2017_01 Ideology_2017_01 Index_Trump_Attitudes_2017_01 ///
Index_Authoritarianism_2016_01 Index_Egalitarianism_2017_01 Index_Nationalism_2016_01 Index_Populism_2017_01 Index_Social_Trust_2016_01 ///
Satisfy_Local_Econ_2017_01 Satisfy_Personal_Income_2017_01 Age_2018 Female_2018 College_2018 i.State_2018 if Consistent_White==1, cluster(State_2018)
outreg2 using tab.tex, addstat(Pseudo R$^2$, `e(r2_p)') dec(3) append
margins, at(White_Identity_2017_01=(0(.25)1)) 
marginsplot

*Mexico & Latin America*
oprobit Immig_Mexico_2018 White_Identity_2017_01 Partisanship_2017_01 Ideology_2017_01 Index_Trump_Attitudes_2017_01 ///
Index_Authoritarianism_2016_01 Index_Egalitarianism_2017_01 Index_Nationalism_2016_01 Index_Populism_2017_01 Index_Social_Trust_2016_01 ///
Satisfy_Local_Econ_2017_01 Satisfy_Personal_Income_2017_01 Age_2018 Female_2018 College_2018 i.State_2018 if Consistent_White==1, cluster(State_2018)
outreg2 using tab.tex, addstat(Pseudo R$^2$, `e(r2_p)') dec(3) append
margins, at(White_Identity_2017_01=(0(.25)1)) 
marginsplot

*Middle East*
oprobit Immig_Mideast_2018 White_Identity_2017_01 Partisanship_2017_01 Ideology_2017_01 Index_Trump_Attitudes_2017_01 ///
Index_Authoritarianism_2016_01 Index_Egalitarianism_2017_01 Index_Nationalism_2016_01 Index_Populism_2017_01 Index_Social_Trust_2016_01 ///
Satisfy_Local_Econ_2017_01 Satisfy_Personal_Income_2017_01 Age_2018 Female_2018 College_2018 i.State_2018 if Consistent_White==1, cluster(State_2018) 
outreg2 using tab.tex, addstat(Pseudo R$^2$, `e(r2_p)') dec(3) append
margins, at(White_Identity_2017_01=(0(.25)1)) 
marginsplot

